<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="title" content="项目概览">
        <meta name="keyword" content="">
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

        <title>项目概览</title>
        <script src="../js/core/zy_control.js"></script>
        <script src="../js/core/zy_click.js"></script>
        <script src="../js/core/appframework.js"></script>
        <script src="../js/core/exif.js"></script>
        <script src="../js/upload.js"></script>
        <script src="../js/download.js"></script>
        <script src="../js/res.js" type='text/javascript'></script>
        <script src="kityminder.edit.js?_=1432798997088" charset="utf-8"></script>
        <script src="kityminder.config.js?_=1432798997088" charset="utf-8"></script>
        <script src="lang/zh-cn/zh-cn.js?_=1432798997088" charset="utf-8"></script>
        <script src="../js/main.js" type='text/javascript'></script>
        <script src="../js/core.js" type='text/javascript'></script>
        <script src="../js/line.js"></script>
        <script src="../js/drag.js"></script>
        <script src="../js/project.js" type='text/javascript'></script>
        <script src="../js/course.js" type='text/javascript'></script>

        <link href="ui/theme/default/css/default.all.css?_=1432798997088" type="text/css" rel="stylesheet" />
        <link href="../css/animate.css" type="text/css" rel="stylesheet" />
        <link href="../css/base.css" type="text/css" rel="stylesheet" />
        <link href="../css/img.css" type="text/css" rel="stylesheet" />

        <link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
        <link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
    </head>

    <body class="ub ub-f1" style="background: rgb(251, 251, 251);">
        <div id="content-wrapper" class="ub-f1">
            <div id="panel"></div>

            <div id="kityminder" onselectstart="return false">

            </div>
        </div>
    </body>

    <script>
        (function(win, doc) {
            var docel = doc.documentElement;
            var meta = doc.querySelectorAll('meta[name=viewport]');
            meta[0].setAttribute('content', 'width=device-width,user-scalable=no,initial-scale=1');
            function recalc() {
                var width = docel.clientWidth;
                docel.style.fontSize = 10 * width / 640 + 'px';
            }

            if (doc) {
                recalc();
                win.addEventListener('orientationchange resize', recalc, false);
            } else if (doc.addEventListener) {
                doc.addEventListener('DOMContentLoaded resize', recalc, false);
            }
        })(window, document);
        $(function() {
            zip.inflateJSPath = 'lib/inflate.js';
        });

        window.uexOnload = function(type) {
            //设置横屏
            try {
                uexWindow.setOrientation(2);
            } catch(e) {
                // alert(e);
            }
            //隐藏滚动条
            // uexWindow.setWindowScrollbarVisible(false);
            //
            uexWindow.onKeyPressed = function(keyCode) {
                if (keyCode == 0) {
                    try {
                        uexWindow.setOrientation(1);
                    } catch(e) {
                        //alert(e);
                    }
                    WinClose();
                }
            };
            setTimeout(function() {
                //
                km = KM.getMinder('kityminder', window.KITYMINDER_CONFIG);
                km.initUI();
                $("#kityminder").css("visibility", "hidden");
                $(".preview-navigator").css("display", "none");
                if (!type) {
                    if (GetLS("projectId")) {
                        $ajax({
                            url : "/project/detail",
                            data : {
                                _id : GetLS("projectId")
                            },
                            success : function(res) {
                                var json = res.result;
                                json.template = "default";
                                json.theme = "fresh-green-compat";
                                json.version = "1.3.5";

                                Project.data = json;

                                km.lazyImportJson(json);

                                km.receiver.updateByMinderNode(km._root);
                                $("#kityminder").css("visibility", "visible");
                                // 延迟展开
                                km.on('mousedown touch click', function(event) {
                                    // 获取当前节点
                                    var _minderNode = event.getTargetNode();
                                    // 判断事件触发源是否是节点
                                    if (_minderNode && _minderNode instanceof KityMinder.MinderNode) {
                                        // 获取子节点数据
                                        var _children = _minderNode.getData("children");
                                        // 获取 判断标志为
                                        var _isLoad = _minderNode.getData("isLoad");
                                        // 判断该节点是否已载入，判断此节点是否有子节点
                                        if (!_isLoad && _children && _children.length > 0) {
                                            for (var i = 0; i < _children.length; i++) {
                                                var e = _children[i];
                                                // 创建子节点
                                                var childNode = km.createNode(null, _minderNode);
                                                //
                                                childNode.data = {};
                                                // 设置自节点属性
                                                for (var field in e) {
                                                    childNode.setData(field, e[field]);
                                                }
                                                childNode.setData('text', e.name || km.getLang(DEFAULT_TEXT[childNode.getType()]));
                                            }
                                            // 设置展开标志位
                                            _minderNode.setData('isLoad', true);
                                            //
                                            _minderNode.setData('children', []);
                                        }
                                        // 刷新脑图
                                        km.refresh(500);
                                        // 判断节点是否展开，如果未展开，则自动展开节点
                                        //if (_minderNode.isCollapsed()){
                                        //    _minderNode.expand();
                                        //}
                                        _minderNode.collapsed();
                                    }
                                });
                            }
                        });
                    } else {
                        var json = '{"name":"' + GetLS("kityName") + '","template":"default","theme":"fresh-green-compat","version":"1.3.5"}';
                        json = JSON.parse(json);
                        km.importJson(json);
                    }
                    $("#back").click(function() {
                        try {
                            uexWindow.setOrientation(1);
                        } catch(e) {
                            alert(e);
                        }
                        //SetLS("isLoad",null);
                        WinClose();
                    });
                    Add20ToHeader();
                }
                //
                km.execCommand('camera', km.getRoot(), 50);
            }, 200);
            //
            uexWindow.setReportKey(0, 1);
        };
    </script>
</html>